﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class VacancyDetails : System.Web.UI.Page
{
    string UrlPath = "";
    string VacancyID = "";
    ApplicantMethord AM = new ApplicantMethord();
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            UrlPath = Request.RawUrl.Substring(Request.RawUrl.LastIndexOf("/") + 1, Request.AppRelativeCurrentExecutionFilePath.Length - 2);
            if (Request.QueryString["ID"].ToString() != "")
            {
                UrlPath += "?ID=" + Request.QueryString["ID"].ToString();
            }
        }
        catch (Exception ex)
        {
        }
        try
        {
            Session["PageCurrent"] = UrlPath;
            VacancyID = Request.QueryString["ID"].ToString();
            LoadData(VacancyID);
        }
        catch (Exception ex)
        {
        }
    }
    private void LoadData(string _Vacancy)
    {
        DataTable tb = AM.ReturnInformationVacancy(_Vacancy);
        if (tb.Rows.Count > 0)
        {
            txtVacancyID.Text = tb.Rows[0]["VacancyID"].ToString();
            txtTitle.Text = tb.Rows[0]["Title"].ToString();
            txtDescription.Text = tb.Rows[0]["Description"].ToString();
            txtDescription.ToolTip = tb.Rows[0]["Description"].ToString();
            txtNumberHired.Text = tb.Rows[0]["NumberOfJob"].ToString();
            txtNumberEmpty.Text = tb.Rows[0]["NumberEmpty"].ToString();
            txtSalary.Text = tb.Rows[0]["Salary"].ToString();
            txtWorkpalce.Text = tb.Rows[0]["Workplace"].ToString();
            txtDateFulfilled.Text = tb.Rows[0]["DateFulfilled"].ToString().Substring(0, tb.Rows[0]["DateFulfilled"].ToString().IndexOf(" "));
            LinkButton1.PostBackUrl = "ApplicantApplyToVacancy.aspx?ID=" + tb.Rows[0]["VacancyID"].ToString(); ;
        }
    }
}